<?php

namespace app\admin\model\taxi;

use think\Model;


class Wldrivers extends Model
{

    

    

    // 表名
    protected $name = 'wldrivers';
    
    // 自动写入时间戳字段
    protected $autoWriteTimestamp = false;

    // 定义时间戳字段名
    protected $createTime = false;
    protected $updateTime = false;
    protected $deleteTime = false;

    // 追加属性
    protected $append = [
        'ManageCardTime_text',
        'status_text',
        'auditonetime_text',
        'audittowtime_text',
        'zsstatus_text'
    ];
    

    
    public function getStatusList()
    {
        return ['0' => __('Status 0'), '1' => __('Status 1'), '2' => __('Status 2')];
    }

    public function getZsstatusList()
    {
        return ['0' => __('Zsstatus 0'), '1' => __('Zsstatus 1'), '2' => __('Zsstatus 2')];
    }


    public function getManagecardtimeTextAttr($value, $data)
    {
        $value = $value ? $value : (isset($data['ManageCardTime']) ? $data['ManageCardTime'] : '');
        return is_numeric($value) ? date("Y-m-d H:i:s", $value) : $value;
    }


    public function getStatusTextAttr($value, $data)
    {
        $value = $value ? $value : (isset($data['status']) ? $data['status'] : '');
        $list = $this->getStatusList();
        return isset($list[$value]) ? $list[$value] : '';
    }


    public function getAuditonetimeTextAttr($value, $data)
    {
        $value = $value ? $value : (isset($data['auditonetime']) ? $data['auditonetime'] : '');
        return is_numeric($value) ? date("Y-m-d H:i:s", $value) : $value;
    }


    public function getAudittowtimeTextAttr($value, $data)
    {
        $value = $value ? $value : (isset($data['audittowtime']) ? $data['audittowtime'] : '');
        return is_numeric($value) ? date("Y-m-d H:i:s", $value) : $value;
    }


    public function getZsstatusTextAttr($value, $data)
    {
        $value = $value ? $value : (isset($data['zsstatus']) ? $data['zsstatus'] : '');
        $list = $this->getZsstatusList();
        return isset($list[$value]) ? $list[$value] : '';
    }

    protected function setManagecardtimeAttr($value)
    {
        return $value === '' ? null : ($value && !is_numeric($value) ? strtotime($value) : $value);
    }

    protected function setAuditonetimeAttr($value)
    {
        return $value === '' ? null : ($value && !is_numeric($value) ? strtotime($value) : $value);
    }

    protected function setAudittowtimeAttr($value)
    {
        return $value === '' ? null : ($value && !is_numeric($value) ? strtotime($value) : $value);
    }


}
